<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section 5.3.&nbsp; Object-Oriented Programming</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-5-SECT-2.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-5-SECT-4.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a name="learnphpmysql-CHP-5-SECT-3"></a>
<h3 id="title-IDABRVVF" class="docSection1Title">5.3. Object-Oriented Programming</h3>
<a name="IDX-CHP-5-0200"></a> 
<a name="IDX-CHP-5-0201"></a> 

<p class="docText">Object-Oriented programming follows the same goals that we discussed when introducing functions, principally to make reusing code easier. It uses <span class="docEmphasis">classes</span><a name="IDX-CHP-5-0202"></a> 
<a name="IDX-CHP-5-0203"></a> 
 to group functions and variables together as an object. It may help to think of objects as little black boxes that can do work without you knowing exactly how it's done.</p>
<p class="docText">They still use functions, but they get a new name when defined in classes. They're called <span class="docEmphasis">methods</span>. The class works as a blue print for creating<a name="IDX-CHP-5-0204"></a> 
<a name="IDX-CHP-5-0205"></a> 
 objects of that type. Variables can still be defined in methods, but they gain the new ability to be defined as part of the class itself.</p>
<p class="docText">When a new object is created from a class, it is called an <span class="docEmphasis">instance</span> of that class. Any variables that are defined in the class get separate storage space in each instance. The separate storage for variables provides the instance of an object with the ability to remember information between method executions. <a class="docLink" href="#learnphpmysql-CHP-5-FIG-3">Figure 5-3</a> demonstrates the relationship between a class and its components.</p>
<a name="learnphpmysql-CHP-5-FIG-3"></a><p><center>
<h5 class="docFigureTitle">Figure 5-3. A class can contain methods and attributes (variables)</h5>
<img border="0" alt="" width="254" height="315" SRC="images/learnphpmysql_0503.jpg">
</center></p><br>
<p class="docText">If you're new to the concepts of OO programming, don't worry about understanding everything right away. We'll work with a class in <a class="docLink" href="learnphpmysql-CHP-7.html#learnphpmysql-CHP-7">Chapter 7</a>, so it's good enough just to know how to call the methods. In fact, anything that can be done with objects can be done with plain functions. It's just a matter of style and personal preference.</p>
<a name="learnphpmysql-CHP-5-SECT-3.1"></a>
<h4 id="title-IDAMTVVF" class="docSection2Title">5.3.1. Creating a Class</H4>
<p class="docText">Classes are typically stored in separate files for reuse. Although we show the class, it isn't required. Let's build an object called <tt>Cat</tt> that has three methods: <tt>meow, eat</tt>, and <tt>purr</tt>. The <tt>class</tt> construct defines a class. It takes the name of the class immediately after it. Class names follow the same naming rules as variables and functions. The code that makes up the class is placed between curly brackets. This example creates the <tt>Cat</tt> class without defining any methods or variables.</p>
<p class="docText">You can do a quick check to see whether the class has been defined, as <a class="docLink" href="#learnphpmysql-CHP-5-EX-10">Example 5-10</a> demonstrates.</p>
<a name="learnphpmysql-CHP-5-EX-10"></a><H5 id="title-IDAHUVVF" class="docExampleTitle">Example 5-10. Creating an object from the Cat class</H5><p><table cellspacing="0" width="90%" border="1" cellpadding="5"><TR><td>

<pre>
&lt;?php
class Cat {
}

$fluffy = new Cat();
echo "Fluffy is a new ".gettype($fluffy)."!";
?&gt;
</pre><br>

</td></TR></table></p>
<p class="docText"><a class="docLink" href="#learnphpmysql-CHP-5-EX-10">Example 5-10</a> displays:</p>
<pre>
Fluffy is a new object!
</pre><BR>


<a name="learnphpmysql-CHP-5-SECT-3.2"></a>
<h4 id="title-IDA0UVVF" class="docSection2Title">5.3.2. Creating an Instance</h4>
<a name="IDX-CHP-5-0206"></a> 
<a name="IDX-CHP-5-0207"></a> 
<a name="IDX-CHP-5-0208"></a> 
<a name="IDX-CHP-5-0209"></a> 

<p class="docText">In <a class="docLink" href="#learnphpmysql-CHP-5-EX-10">Example 5-10</a>, you not only defined the class but also created an instance of it. You used the <tt>new</tt> keyword to tell PHP to return a new instance of the <tt>Cat</tt> class. Although the class doesn't do anything, you can tell that it's defined as an object. The class is a blueprint for building instances.<a name="IDX-CHP-5-0210"></a> 
 The class specifies what is included in each new instance of that class. Each instance can do everything the class defines, but does it independently of any other instance you've created.</P>

<a name="learnphpmysql-CHP-5-SECT-3.3"></a>
<h4 id="title-IDAFWVVF" class="docSection2Title">5.3.3. Methods and Constructors</h4>
<p class="docText">Methods are the functions defined within the class. They work within the environment of the class, including its variables. For classes, there is a special method called a <span class="docEmphasis">constructor</span> that's called when a new instance of a class is created to do any work that initializes the class, such as setting up the values of variables in the class. The constructor is defined by creating<a name="IDX-CHP-5-0211"></a> 
 a method that has the same name as the class, as shown in <a class="docLink" href="#learnphpmysql-CHP-5-EX-11">Example 5-11</a>.</p>
<a name="learnphpmysql-CHP-5-EX-11"></a><h5 id="title-IDA1WVVF" class="docExampleTitle">Example 5-11. Creating the Cat constructor</H5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
class Cat {
  // Constructor
  function Cat() {
  }
}
?&gt;
</pre><br>

</td></TR></table></p>
<p class="docText">PHP 5 supports a new syntax for creating a constructor method using <tt>_ _construct</tt>, as shown in <a class="docLink" href="#learnphpmysql-CHP-5-EX-12">Example 5-12</a>. If a class in PHP 5 doesn't have this method, the old style of using the class name as the method name is used.</P>
<a name="learnphpmysql-CHP-5-EX-12"></a><h5 id="title-IDAOXVVF" class="docExampleTitle">Example 5-12. Using the PHP 5 style constructor</H5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><TR><td>

<pre>
&lt;?php
class Cat {
  // Constructor
  &gt;__construct(){
  }
}
?&gt;
</pre><br>

</td></tr></table></p>
<p class="docText">The constructor may also contain parameters like any other method. Additionally, classes can contain user-defined methods. For the <tt>Cat</tt> class, you can define <tt>meow, eat</tt>, and <tt>purr</tt>, as shown in <a class="docLink" href="#learnphpmysql-CHP-5-EX-13">Example 5-13</a>.</p>
<a name="learnphpmysql-CHP-5-EX-13"></a><h5 id="title-IDAIYVVF" class="docExampleTitle">Example 5-13. Defining three member functions for Cat</h5><p><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
Class Cat {
  // Constructor
  function Cat() {
  }

  // The cat meows
  function meow() {
    echo "Meow...";
  }

  // The cat eats
  function eat() {
    echo "*eats*";
  }

  // The cat purrs
  function purr() {
    echo "*Purr...*";
  }
}
?&gt;
</pre><br>

</td></tr></table></P>
<p class="docText">When you declare a new instance of a class, the user-defined constructor is always called, assuming that one exists. As you know, a class provides the blueprint for objects. You create an object from a class. If you see the phrase "instantiating a class," this means the same thing as creating an object; therefore, you can think of them as being synonymous. When you create an object, you are creating an instance of a class, which means you are instantiating a class.</p>
<p class="docText">The <tt>new</tt> operator instantiates a class by allocating memory for that new object, which means that it requires a single, postfix argument, which is a call to a constructor. The name of the constructor provides the name of the class to instantiate, and the constructor initializes the new object.</p>
<p class="docText">The <tt>new</tt> operator returns a reference to the object that was created. Most of the time, this reference is assigned to a variable of the appropriate type. However, if the reference is not assigned to a variable, the object is unreachable after the statement in which the <tt>new</tt> operator finishes executing. <a class="docLink" href="#learnphpmysql-CHP-5-EX-14">Example 5-14</a> shows how not to use <tt>new</tt>, and then how better to use it.</P>
<a name="learnphpmysql-CHP-5-EX-14"></a><H5 id="title-IDAGZVVF" class="docExampleTitle">Example 5-14. Creating a new object without saving the reference, then creating an object to keep around</h5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
new Cat;
//the Cat object cannot be accessed since its reference wasn't saved

$myCat=new Cat;
//this time we've kept the new Cat object available
?&gt;
</pre><br>

</TD></tr></table></p>
<P><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><tr><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><TR><td width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><td valign="top">
<p class="docText">When declaring new instances of a class, if the constructor does not contain any parameters, it's optional to use parenthesis (<tt>()</tt>) after the class name in the <tt>new</tt> statement.</p>
</TD></TR></table></td></tr></table></p><br>

<a name="learnphpmysql-CHP-5-SECT-3.4"></a>
<H4 id="title-IDA2ZVVF" class="docSection2Title">5.3.4. Variable Scope Within Classes</h4>
<a name="IDX-CHP-5-0212"></a> 
<a name="IDX-CHP-5-0213"></a> 
<a name="IDX-CHP-5-0214"></a> 

<p class="docText">Classes may contain variables that help define their structure and how they are used. Variables inside a class are declared with the <tt>var</tt> statement. The <tt>var</tt> statement declares a variable to have <span class="docEmphasis">class scope</span>.<a name="IDX-CHP-5-0215"></a> 
 Class scope means they're visible with any methods of the class and can be referenced outside the class using a special construct. <a class="docLink" href="#learnphpmysql-CHP-5-EX-15">Example 5-15</a> adds the <tt>$age</tt> variable to the <tt>Cat</tt> class.</P>
<a name="learnphpmysql-CHP-5-EX-15"></a><h5 id="title-IDAH1VVF" class="docExampleTitle">Example 5-15. Adding the $age variable to Cat</H5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><TR><td>

<pre>
&lt;?php
class Cat {
  // How old the cat is
  var $age;
}
?&gt;
</pre><br>

</td></tr></table></p>
<p class="docText">When referring to methods and variables from within the class, you must use the syntax:</p>
<pre>
$this-&gt;<tt><i>variable or method name</i></tt>;
</pre><br>

<p class="docText">The special variable <tt>$this</tt> always points to the currently executing object.</p>
<p class="docText">In <a class="docLink" href="#learnphpmysql-CHP-5-EX-16">Example 5-16</a>, the <tt>this-&gt;</tt> operator is used to modify the value of <tt>$age</tt>. The arrow is similar to the dot (<tt>.</tt>) notation used in other languages to navigate objects.</p>
<a name="learnphpmysql-CHP-5-EX-16"></a><h5 id="title-IDAK2VVF" class="docExampleTitle">Example 5-16. Accessing the $age variable using this-&gt;</h5><p><table cellspacing="0" width="90%" border="1" cellpadding="5"><TR><td>

<pre>
?php
class Cat {
  // How old the cat is
  var $age;

  // Constructor
  function Cat($new_age)
  {
    // Set the age of this cat to the new age
    $this-&gt;age = $new_age;
  }
  //The birthday method increments the age variable
  function Birthday()
  {
    $this-&gt;age++;
  }
}
// Create a new instance of the cat object that's one year old
$fluffy=new Cat(1);
echo "Age is $fluffy-&gt;age &lt;br/&gt;";
echo "Birthday&lt;br/&gt;";
// Increase fluffy's age
$fluffy-&gt;Birthday();
echo "Age is $fluffy-&gt;age &lt;br/&gt;";
?&gt;
</pre><br>

</TD></TR></table></p>
<p class="docText"><a class="docLink" href="#learnphpmysql-CHP-5-EX-16">Example 5-16</a> produces:</P>
<pre>
Age is 1
Birthday
Age is 2
</pre><br>

<p class="docText">Notice that you can access the value of <tt>$age</tt> from outside of the class by using the name of the class instead of <tt>this</tt> with the <tt>-&gt;</tt> operator.</p>

<a name="learnphpmysql-CHP-5-SECT-3.5"></a>
<h4 id="title-IDAG3VVF" class="docSection2Title">5.3.5. Inheritance</H4>
<a name="IDX-CHP-5-0216"></a> 
<a name="IDX-CHP-5-0217"></a> 
<a name="IDX-CHP-5-0218"></a> 

<p class="docText">When declaring classes, it is also possible to separate functionality into subclasses that automatically inherit the methods and variables of the class on which they are based. This can be useful if you're adding functionality to a class without modifying the original class. <a class="docLink" href="#learnphpmysql-CHP-5-EX-17">Example 5-17</a> demonstrates how properties and methods are inherited from the parent class for the <tt>Domestic_Cat</tt> class.</p>
<a name="learnphpmysql-CHP-5-SECT-3.5.1"></a>
<h5 id="title-IDAD4VVF" class="docSection3Title">5.3.5.1. The extends operator</H5>
<a name="IDX-CHP-5-0219"></a> 
<a name="IDX-CHP-5-0220"></a> 

<p class="docText">When a class inherits from another class, the class that it inherits from is called the <span class="docEmphasis">superclass</span>. When declaring a subclass, use the <tt>extends</tt> keyword to specify which class is being inherited from. <a class="docLink" href="#learnphpmysql-CHP-5-EX-17">Example 5-17</a> shows an example of this.</p>
<a name="learnphpmysql-CHP-5-EX-17"></a><h5 id="title-IDAA5VVF" class="docExampleTitle">Example 5-17. Using the extends keyword to define a subclass</H5><p><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
class Cat {
  // How old the cat is
  var $age;

  function Cat($new_age)
  {
    // Set the age of this cat to the new age
    $this-&gt;age = $new_age;
  }
  function Birthday()
  {
    $this-&gt;age++;
  }
}
class Domestic_Cat extends Cat {
  // Constructor
  function Domestic_Cat() {
  }

  // Sleep like a domestic cat
  function sleep() {
  echo("Zzzzzz.&lt;br/&gt;");
  }
}
$fluffy=new Domestic_Cat();
$fluffy-&gt;Birthday();
$fluffy-&gt;sleep();
echo "Age is $fluffy-&gt;age &lt;br&gt;/";
?&gt;
</pre><br>

</TD></TR></table></p>
<p class="docText"><a class="docLink" href="#learnphpmysql-CHP-5-EX-17">Example 5-17</a> outputs:</p>
<pre>
Zzzzzz.
Age is 1
</pre><br>

<p class="docText">Notice that you can access the <tt>Birthday</tt> function from the <tt>Cat</tt> class and the newly defined <tt>sleep</tt> method regardless of which level in the object defined the method.</p>

<a name="learnphpmysql-CHP-5-SECT-3.5.2"></a>
<H5 id="title-IDA25VVF" class="docSection3Title">5.3.5.2. The parent operator</h5>
<a name="IDX-CHP-5-0221"></a> 
<a name="IDX-CHP-5-0222"></a> 
<a name="IDX-CHP-5-0223"></a> 

<p class="docText">A <tt>Domestic_Cat</tt> is a <tt>Cat</tt> in all respects. It still contains the base methods of a <tt>Cat</tt>. It's also possible to override existing functionality from the superclass to provide your own new code. When extending classes to override functions in your class that are already defined in the superclass, you can still execute the code from the parent class then add on your own functionality.</P>
<p class="docText">To call the parent class method before your code, use:</p>
<pre>
parent::<tt><I>method_from_parent</I></tt>
</pre><BR>

<p class="docText">This calls the parent method in the superclass. You can then add to your code like in <a class="docLink" href="#learnphpmysql-CHP-5-EX-18">Example 5-18</a>.</p>
<a name="learnphpmysql-CHP-5-EX-18"></a><h5 id="title-IDAMBWVF" class="docExampleTitle">Example 5-18. Using the parent construct</h5><p><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
class Cat {
  // How old the cat is
  var $age;

  function Cat($new_age)
  {
    // Set the age of this cat to the new age
    $this-&gt;age = $new_age;
  }
  function Birthday()
  {
    $this-&gt;age++;
  }
  function Eat()
  {
    echo "Chomp chomp.";
  }
  function Meow()
  {
    echo "Meow.";
  }
}

class Domestic_Cat extends Cat {
  // Constructor
  function Domestic_Cat() {
  }

  // Eat like a Domestic_Cat
  function eat() {
    parent::eat();
    // After we're finished eating, let's meow
    $this-&gt;meow();
  }
}
?&gt;
</pre><br>

</td></tr></table></p>
<p class="docText">This calls the <tt>eat</tt> function from the superclass, and then adds the code for meowing.</p>
<p class="docText">When you extend a class and declare your own constructor, PHP won't automatically call the constructor of the parent class. You should always call the constructor of the parent class to be sure all initialization code gets executed, as shown in <a class="docLink" href="#learnphpmysql-CHP-5-EX-19">Example 5-19</a>.</p>
<a name="learnphpmysql-CHP-5-EX-19"></a><h5 id="title-IDACCWVF" class="docExampleTitle">Example 5-19. Calling the constructor of the parent class</h5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
&lt;?php
  class Cat {
  // How old the cat is
  var $age;

  function Cat($new_age)
  {
    // Set the age of this cat to the new age
    $this-&gt;age = $new_age;
  }
  function Birthday()
  {
    $this-&gt;age++;
  }
  function Eat()
  {
    echo "Chomp chomp.";
  }
  function Meow()
  {
    echo "Meow.";
  }
}
class Domestic_Cat extends Cat {
  // Constructor
  function Domestic_Cat($new_age) {
    // This will call the constructor
    // in the parent class (the superclass)
    parent::Cat($new_age);
  }
}
?&gt;
</pre><BR>

</TD></tr></table></P>
<p class="docText">When a new instance of <tt>Domestic_Cat</tt> is created, the constructor from the <tt>Cat</tt> class is called.</p>


<a name="learnphpmysql-CHP-5-SECT-3.6"></a>
<h4 id="title-IDAUCWVF" class="docSection2Title">5.3.6. Static Methods and Variables</h4>
<a name="IDX-CHP-5-0224"></a> 
<a name="IDX-CHP-5-0225"></a> 

<p class="docText">Methods and variables can also be used and accessed as if they are static<a name="IDX-CHP-5-0226"></a> 
<a name="IDX-CHP-5-0227"></a> 
<a name="IDX-CHP-5-0228"></a> 
<a name="IDX-CHP-5-0229"></a> 
 in a class. <span class="docEmphasis">Static</span> means the method or variable is accessible through the class definition and not just through objects. In PHP 4, there is no way to designate a variable to be static; however, in PHP 5.0, you can use the <tt>static</tt> modifier. We'll discuss the syntax that PHP provides to access static values in a class next.</P>
<a name="learnphpmysql-CHP-5-SECT-3.6.1"></a>
<h5 id="title-IDA5DWVF" class="docSection3Title">5.3.6.1. The :: operator (scope resolution)</h5>
<p class="docText">The <tt>::</tt> operator allows you to refer to variables and methods on a class that doesn't yet have any instances or objects created for it. When you plan on using the scope resolution operator on a method, you can also detect inside the called function if the method was called using the scope resolution operator (<tt>::</tt>) or through an object (<tt>-&gt;</tt>) by the <tt>$this</tt> operator, as shown in <a class="docLink" href="#learnphpmysql-CHP-5-EX-20">Example 5-20</a>.</P>
<a name="learnphpmysql-CHP-5-EX-20"></a><h5 id="title-IDAVEWVF" class="docExampleTitle">Example 5-20. Using the -&gt; operator to call hypnotize</h5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><tr><td>

<pre>
class Hypnotic_Cat extends Cat {
  // Constructor
  function Hypnotic_Cat() {
  }

  // This is meant to be called statically
  function hypnotize() {
  //detects that the function is being called statically
  //since a static call doesn't have an object to point to
    if ($this == null)
      echo ("All cats are hypnotized.");
    else
    {
      echo ("The cat was hypnotized.");
      return;
    }
  }
}

// Hypnotize all cats
Hypnotic_Cat::hypnotize();

$hypnotic_cat = new Hypnotic_Cat();
// Does nothing
$hypnotic_cat-&gt;hypnotize();
</pre><br>

</td></TR></table></P>
<p class="docText">When a method is called using the scope resolution operator (<tt>::</tt>), you can't use the <tt>$this</tt> object to refer to the object, since there is no object.</p>


<a name="learnphpmysql-CHP-5-SECT-3.7"></a>
<h4 id="title-IDAHFWVF" class="docSection2Title">5.3.7. Variable References</h4>
<p class="docText">In PHP, a variable name points to a location in memory that stores the data. There can be more than one variable name pointing to the same spot in memory. The ampersand operator (<tt>&amp;</tt>) is used to indicate that you're interested in the location in memory that a variable points to instead of its value.</p>
<p class="docText">PHP references<a name="IDX-CHP-5-0230"></a> 
<a name="IDX-CHP-5-0231"></a> 
 allow you to create two variables<a name="IDX-CHP-5-0232"></a> 
 to refer to the same content. Therefore, changing the value of one variable can change the value of another. This can make it very difficult to find errors in your code, since changing one variable also changes the other.</P>
<p class="docText">The same syntax can be used with functions that return referencesfor example, using the <tt>new</tt> operator. <a class="docLink" href="#learnphpmysql-CHP-5-EX-21">Example 5-21</a> uses this to reference the <tt>$some</tt> variable.</p>
<a name="learnphpmysql-CHP-5-EX-21"></a><H5 id="title-IDARGWVF" class="docExampleTitle">Example 5-21. Referencing the $some_variable</h5><P><table cellspacing="0" width="90%" border="1" cellpadding="5"><TR><TD>

<pre>
&lt;?php
$some_variable = "Hello World!";
$some_reference = &amp;$some_variable;
$some_reference = "Guten Tag World!";
echo $some_variable;
echo $some_reference;
?&gt;
</pre><br>

</td></tr></table></p>
<p class="docText"><a class="docLink" href="#learnphpmysql-CHP-5-EX-21">Example 5-21</a> outputs:</p>
<pre>
Gutentag World!Guten Tag World!
</pre><br>

<p class="docText"><a class="docLink" href="#learnphpmysql-CHP-5-EX-21">Example 5-21</a> shows that a reference is set using the <tt>&amp;</tt> operator and precedes the <tt>$</tt> in the existing variable. The variable <tt>$some_reference</tt> refers to <tt>$some_variable</tt> (the memory location where <tt>"Hello World!"</tt> resides) and any operation, with the exception of setting to another reference, operates on <tt>$some_variable</tt>.</p>
<p class="docText">As discussed earlier, variable references are useful for passing a variable by reference as a parameter to a function. This allows the function to modify the variable in your main code instead of modifying a local copy that's lost when the function completes.</p>
<p class="docText">Assigning a variable to another variable without using the reference operator results in a copy of the variable being placed into a new location in memory. The new variable can be changed without modifying the original variable. While this takes more memory, it's the way to go if you don't want to change the original variable's value.</p>
<p class="docText">Now that you've learned about functions and classes, you're ready to start working with more complex data, such as arrays. Arrays will be very useful when working with data from a database, since they can easily hold the data from a query.</p>


<a href="11011536.html"><img src="images/pixel.jpg" alt="" width="1" height="1" border="0"></a></TD></TR></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-5-SECT-2.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-5-SECT-4.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<script type="text/javascript"><!--
google_ad_client = "pub-0203281046321155";
google_alternate_ad_url = "http://www.bookhtml.com/adbrite.htm";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="4867465545";
google_color_border = "FFFFFF";
google_color_link = "0000FF";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "0000FF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</html>
